package tp.pr2;

public class Instruction {
	private Action action;
	private Rotation rotation;
	private java.lang.String id;
	
	public Instruction()
	{
	 action=Action.UNKNOWN;
	 rotation=Rotation.UNKNOWN;
	 id="";
	 
	}
	
	public Instruction(Action action)
	{
     this.action=action;
     rotation=Rotation.UNKNOWN;
     id="";
	}
	
	public Instruction(Action action, Rotation rotation)
	{
		this.action=action;
		this.rotation=rotation;
		id="";
	}
	
	public Instruction(Action action, java.lang.String id)
	{
	this.action=action;
	this.id=id;
	this.rotation=Rotation.UNKNOWN;
	}
	
	public boolean isValid()
	{
		switch(this.action)
			{
				case UNKNOWN: return false;
				case HELP:return true;
				case QUIT:return true;
				case MOVE:return true;
				case SCAN:return true;
				case PICK:if(!this.id.equals("")) return true;
				case OPERATE:if(!this.id.equals("")) return true; 
				case TURN:
					switch(this.rotation)
						{
							case LEFT: return true;
							case RIGHT: return true;
							case UNKNOWN: return false;
							default: return false;
						}
				default: return false;	
			}
	}
	/**/
	public Action getAction()
	{
		return action;
	}
	
	public Rotation getRotation()
	{
		return rotation;
	}
	
	public java.lang.String getId()
	{
		return id;
	}	
	
	
}